<?php

define('ROOT', dirname(dirname(dirname(__FILE__))));

return array(
    'name' => 'www.ixuepin.us',
    'basePath' => ROOT . '/protected',
    //'runtimePath' => ROOT.'/protected/runtime',
    'preload' => array('log'), // 预加载日志模块
    'language' => 'zh_CN',
    'import' => array(
        'application.modules.*',
        'application.modules.siteAnalyzer.*',
        'application.models.*',
    ),
    'components' => array(
        'db' => array(
            'class' => 'CDbConnection',
            'connectionString' => 'mysql:host=127.0.0.1;dbname=ixuepin',
            'emulatePrepare' => TRUE,
            'username' => 'root',
            'password' => 'mysql',
            'charset' => 'utf8',
            'tablePrefix' => '',
            'schemaCachingDuration' => 0, // 数据缓存时间
            'enableProfiling' => FALSE, // 是否开启数据缓存
        ),
        'db_log' => array(
            'class' => 'CDbConnection',
            'connectionString' => 'mysql:host=127.0.0.1;dbname=logs',
            'emulatePrepare' => TRUE,
            'username' => 'root',
            'password' => 'mysql',
            'charset' => 'utf8',
            'tablePrefix' => '',
            'schemaCachingDuration' => 0, // 数据缓存时间
            'enableProfiling' => FALSE, // 是否开启数据缓存
        ),
        'urlManager' => array(
            'urlFormat' => 'path',
            'showScriptName' => FALSE,
            //'urlSuffix' => '.html',// URL结尾符号
            'rules' => include 'url.php',
        ),
        'request' => array(
            'enableCookieValidation' => TRUE, // 防止Cookie攻击,要用CHttpCookie
        ),
        'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CFileLogRoute', // 文件记录日志
                    'levels' => 'error, warning, trace, info',
                    'categories' => 'system.*',
                ),
                array(
                    'class' => 'CDbLogRoute',
                    'levels' => 'error, warning, trace, info',
                    'categories' => 'system.*',
                    'logTableName' => 'log',
                    'connectionID' => 'db',
                    'autoCreateLogTable' => TRUE,
                    'enabled' => TRUE,
                ),
            ),
        ),
        'session' => array(
            'class' => 'CDbHttpSession', // 基于数据库的session
            'connectionID' => 'db',
            'sessionTableName' => 'user_session',
            'autoCreateSessionTable' => TRUE,
        ),
        'user' => array(
            'allowAutoLogin' => TRUE, // enable cookie-based authentication
            'identityCookie' => array('domain' => '.ixuepin.us'),
        ),
        'cache' => array(
            'class' => 'CFileCache', //文件缓存
            //'cachePath' =>  ROOT.'/runtime/cache',// 缓存目录
            'directoryLevel' => '1', // 缓存文件的目录深度
        ),
        'request' => array(
            'enableCookieValidation' => TRUE, // 防止Cookie攻击,要用CHttpCookie
        ),
        'assetManager' => array(
            'BasePath' => ROOT . '/public/static/assets',
            'baseUrl' => '/static/assets',
        ),
    ),
    // 加载全局变量
    // 调用方法 Yii::app()->params['paramName']
    'params' => array(
        'domain' => 'http://ifollow.us',
        'static_domain' => 'http://static.ixuepin.us',
        'cache_timeout' => 3600 * 6, 
        ),
);